﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ChatData;
using Server;

namespace Client
{
    public partial class Users : Form
    {
        ActiveUserStore<Record> thestore;
        public Users( ActiveUserStore<Record> e)
        {
            InitializeComponent();
            thestore = e;
            foreach (KeyValuePair<String,Record> item in thestore)
            {
                this.kryptonListBox1.Items.Add(item.Value.Username);
            }
        }
        public string Selection
        {
            get { return kryptonListBox1.SelectedItem.ToString(); }
        }
        private void kryptonButtonSelect_Click(object sender, EventArgs e)
        {
            this.DialogResult =  DialogResult.Yes;
            this.Close();
        }

        private void kryptonButtonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void kryptonListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.kryptonLabelUser.Text = this.kryptonListBox1.SelectedItem.ToString();
            this.kryptonLabelStatus.Text = thestore.getStatus(this.kryptonListBox1.SelectedItem.ToString());
        }
    }
}
